package com.view.mediator
{
	import com.ApplicationFacade;
	import com.view.component.WelcomeView;

	import org.puremvc.as3.multicore.interfaces.IMediator;
	import org.puremvc.as3.multicore.patterns.mediator.Mediator;
	import org.puremvc.as3.multicore.utilities.statemachine.StateMachine;

	import flash.events.Event;

	public class WelcomeViewMediator extends Mediator implements IMediator
	{
		public static const NAME:String='WelcomeViewMediator';

		public function WelcomeViewMediator(viewComponent:Object)
		{
			super(NAME, viewComponent);
		}

		protected function get welcomeView():WelcomeView
		{
			return viewComponent as WelcomeView;
		}

		override public function onRegister():void
		{
			welcomeView.labelText=NAME + " says Welcome.";
			welcomeView.addEventListener(WelcomeView.SHOW_MAIN, onShowMain);
		}

		protected function onShowMain(event:Event):void
		{
			sendNotification(StateMachine.ACTION, "COLLECT", ApplicationFacade.COLLECT);
		}
	}
}